#ifndef __PTGUI_H__
#define __PTGUI_H__

#include <system.h>

#include <ptgui/typedef.h>
#include <ptgui/config.h>
#include <ptgui/list.h>
#include <ptgui/memory.h>
#include <ptgui/utility.h>

typedef struct ptgui_image ptgui_image_t;
typedef struct ptgui_surface ptgui_surface_t;
typedef struct ptgui_dc ptgui_dc_t;
typedef struct ptgui_widget ptgui_widget_t;
typedef struct ptgui_scene ptgui_scene_t;
typedef	struct ptgui_event ptgui_event_t;

typedef rt_bool_t (*ptgui_event_handler_ptr)(ptgui_widget_t *widget, struct ptgui_event *event);
typedef void (*ptgui_render_handler_ptr)(ptgui_widget_t *widget);
typedef void (*ptgui_frame_handler_ptr)(ptgui_widget_t *widget, rt_uint32_t fDelta);

struct ptgui_point
{
	rt_int16_t	x,
				y;
};
typedef struct ptgui_point ptgui_point_t;

struct ptgui_rect
{
	rt_int16_t	x1,
				y1,
				x2,
				y2;
};
typedef struct ptgui_rect ptgui_rect_t;
#define ptgui_rect_init(r)	do {r.x1 = r. x2 = r.y1 = r.y2 = 0;} while (0);
#define ptgui_rect_width(r)		((r).x2 - (r).x1)
#define ptgui_rect_height(r)	((r).y2 - (r).y1)

#define PTGUI_MASK(value) (1 << value)

enum PTGUI_MARGIN_STYLE
{
	PTGUI_MARGIN_LEFT	= 0x01,
	PTGUI_MARGIN_RIGHT	= 0x02,
	PTGUI_MARGIN_TOP	= 0x04,
	PTGUI_MARGIN_BOTTOM	= 0x08,
	PTGUI_MARGIN_ALL	= PTGUI_MARGIN_LEFT | PTGUI_MARGIN_RIGHT | PTGUI_MARGIN_TOP | PTGUI_MARGIN_BOTTOM
};
enum PTGUI_BORDER_STYLE
{
	PTGUI_BORDER_NONE	= 0,
	PTGUI_BORDER_SIMPLE,
	PTGUI_BORDER_RAISE,
	PTGUI_BORDER_SUNKEN,
	PTGUI_BORDER_BOX,
	PTGUI_BORDER_STATIC,
	PTGUI_BORDER_EXTRA,
	PTGUI_BRDER_UP,
	PTGUI_BORDER_DOWN
};
#define PTGUI_BORDER_DEFAULT_WIDTH	2
#define PTGUI_WIDGET_DEFAULT_MARGIN	3

enum PTGUI_ORIENTATION
{
	PTGUI_HORIZONTAL		= 0x01,
	PTGUI_VERTICAL			= 0x02,
	PTGUI_ORIENTATION_BOTH	= PTGUI_HORIZONTAL | PTGUI_VERTICAL
};

enum PTGUI_ALIGN
{
	PTGUI_ALIGN_NOT					= 0x00,
	PTGUI_ALIGN_CENTER_HORIZONTAL	= 0x01,
	PTGUI_ALIGN_LEFT				= PTGUI_ALIGN_NOT,
	PTGUI_ALIGN_TOP					= PTGUI_ALIGN_NOT,
	PTGUI_ALIGN_RIGHT				= 0x02,
	PTGUI_ALIGN_BOTTOM				= 0x04,
	PTGUI_ALIGN_CENTER_VERTICAL		= 0x08,
	PTGUI_ALIGN_EXPAND				= 0x10,
	PTGUI_ALIGN_STRETCH				= 0x20
};

enum PTGUI_ARRAW
{
	PTGUI_ARRAW_UP	= 0,
	PTGUI_ARRAW_DOWN,
	PTGUI_ARRAW_LEFT,
	PTGUI_ARRAW_RIGHT
};

enum PTGUI_MODAL_CODE
{
	PTGUI_MODAL_OK,
	PTGUI_MODAL_CANCEL
};
typedef enum PTGUI_MODAL_CODE rtgui_modal_code_t;

#include <ptgui/system.h>
#include <ptgui/monitor.h>
#include <ptgui/color.h>
#include <ptgui/font.h>
#include <ptgui/object.h>
#include <ptgui/dc.h>
#include <ptgui/image.h>
#include <ptgui/surface.h>
#include <ptgui/widgets/widget.h>
#include <ptgui/region.h>
#include <ptgui/event.h>

typedef struct ptgui_gui
{
	ptgui_list_t	entities_list;
} ptgui_gui_t;

void ptgui_gui_init(ptgui_gui_t *gui);
ptgui_gui_t *ptgui_gui_create(void);
void ptgui_gui_render(ptgui_gui_t *gui);
void ptgui_gui_frame(ptgui_gui_t *gui, rt_uint32_t fDelta);
void ptgui_gui_add(ptgui_gui_t *gui, ptgui_widget_t *widget);
void ptgui_gui_remove(ptgui_gui_t *gui, ptgui_widget_t *widget);

#endif

